home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Pascal / Code Resources / Eclectic CDEFs / CDEF Utilities / JumpCDEF Folder / JumpCDEFIntf.p < prev   
Text File  |  1997-02-27  |  1KB  |  63 lines

  1. {    JumpCDEFIntf    }
  2. {}
  3. {    Interface for the JumpCDEF resource stub    }
  4. {}
  5. {    Copyright © Sebastiano Pilla 1996    }
  6. {    All rights reserved    }
  7.  
  8. {    <mailto:case@tvol.it>    }
  9.  
  10. {    Add this unit to your projects to have ability of debugging the CDEF in your favourite    }
  11. {    source level debugger. See the file JumpCDEF Info for documentation details    }
  12.  
  13. unit JumpCDEFIntf;
  14.  
  15.  
  16. interface
  17.  
  18.  
  19. {    InstallCDEFUPP    }
  20. {}
  21. {    Installs a real control definition procedure into the jump record    }
  22. {}
  23. {    Entry:    inControlDefProcPtr = pointer to the real control definition procedure    }
  24. {    Exit:    function result = error code    }
  25.     function InstallCDEFUPP (inControlDefProc: ControlDefProcPtr): OSErr;
  26.  
  27.  
  28. implementation
  29.  
  30.  
  31.     const
  32.         kCDEFJumpResType = 'CJMP';            { resource type of the 'CJMP' resource }
  33.         kCDEFJumpResID = 128;                { resource ID of the 'CJMP' resource }
  34.  
  35.  
  36.     type
  37.         CDEFJumpHandle = ^CDEFJumpPtr;
  38.         CDEFJumpPtr = ^CDEFJumpRec;
  39.         CDEFJumpRec = record
  40.                 fRealDefUPP: ControlDefUPP;
  41.             end;
  42.  
  43.  
  44.     function InstallCDEFUPP (inControlDefProc: ControlDefProcPtr): OSErr;
  45.         var
  46.             jmpHdl: CDEFJumpHandle;
  47.             err: OSErr;
  48.     begin
  49.         jmpHdl := CDEFJumpHandle(GetResource(kCDEFJumpResType, kCDEFJumpResID));
  50.         err := ResError;
  51.         if (jmpHdl <> nil) and (err = noErr) then
  52.             begin
  53.                 HLock(Handle(jmpHdl));
  54.                 jmpHdl^^.fRealDefUPP := NewControlDefProc(inControlDefProc);
  55.                 HUnlock(Handle(jmpHdl));
  56.                 ChangedResource(Handle(jmpHdl));
  57.                 HNoPurge(Handle(jmpHdl));
  58.             end;
  59.         InstallCDEFUPP := err;
  60.     end;
  61.  
  62.  
  63. end.